<!DOCTYPE html>
<html lang="en"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets" 
>
    <h:body>
 
    	<ui:composition template="../Template/template.xhtml">
    		<ui:define name="content">
    			<f:metadata>
    				<f:event type="preRenderView" listener="#{ViewChatBean.initPage}"/>
				</f:metadata>
    			<section id="content">
	    			<h2> Historique de conversation avec  <h:outputText value="#{ViewChatBean.currentUserChatter.usrFirstname} #{ViewChatBean.currentUserChatter.usrLastname}"/> </h2>
	    			<p>
	    				Voir l'historique de conversation avec <h:outputText value="#{ViewChatBean.currentUserChatter.usrFirstname} #{ViewChatBean.currentUserChatter.usrLastname}"/>
	    			</p>
	    			<h:form>
   						<ui:repeat var="m" value="#{ViewChatBean.messagesList}" varStatus="status">
   							<section>
								<div>
									<h:outputText value="#{m.msgDate}"/>
									:  
									<strong>
										<h:outputText value="#{ViewChatBean.currentUserChatter.usrFirstname} #{ViewChatBean.currentUserChatter.usrLastname}" rendered="#{ViewChatBean.currentUserChatter.usrId == m.sender.usrId}"/>
   										<h:outputText value="#{ViewChatBean.currentUser.usrFirstname} #{ViewChatBean.currentUser.usrLastname}" rendered="#{ViewChatBean.currentUser.usrId == m.sender.usrId}"/>
   										<h:outputText value="#{ViewChatBean.currentUserSrc.usrFirstname} #{ViewChatBean.currentUserSrc.usrLastname}" rendered="#{ViewChatBean.currentUserSrc.usrId == m.sender.usrId}"/>
									</strong>
									:
									<h:outputText value="#{m.msgContent}"/>
								</div>
   							</section>
   						</ui:repeat>
   					</h:form>
				</section>
    		</ui:define>
    	</ui:composition>    	
    </h:body>
 
</html>